package com.igoal.dto;

import com.igoal.entity.User;
import com.igoal.entity.UserFriend;
import com.igoal.utils.SynchronizeAttributeWithOther;
import com.igoal.utils.SynchronizeDirection;

public class FriendRequestDTO extends BaseDTO<UserFriend> {
	private String from;
	private String fromAvatar;
	
	public String getFromAvatar() {
		return fromAvatar;
	}
	public void setFromAvatar(String fromAvatar) {
		this.fromAvatar = fromAvatar;
	}
	public String getFrom() {
		return from;
	}
	public void setFrom(String from) {
		this.from = from;
	}
	
	@SynchronizeAttributeWithOther(direction=SynchronizeDirection.FROM, value="from")
	public void initFromUser(Object entity){
		if(entity != null && entity instanceof User){
			User user = (User) entity;
			this.from = user.getUsername();
			this.fromAvatar = user.getAvatar();
		}
	}
}
